package com.hackerrank.challenges.taskscheduling;

import java.util.BitSet;
import java.util.Scanner;

public class Solution {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int T = in.nextInt(), o = 0;
		BitSet m = new BitSet(100000000);
		for(int t = 0; t < T; t++) {
			int D = in.nextInt(), M = in.nextInt(), i = D - 1;
			while(M > 0 && i >= 0) {
				if(!m.get(i)) {
					m.set(i);
					M--;
				}
				i--;
			}
			o += M;
			System.out.println(o);
		}
	}
}
